/** 学员管理路由 */
import Layout from '@/views/layout/CrmLayout'

// const layout = function(meta = {}) {
//   return {
//     path: '',
//     component: Layout,
//     meta: {
//       requiresAuth: true,
//       ...meta
//     }
//   }
// }
const layout = function (path, alwaysShow, meta) {
  return {
    path: path,
    component: Layout,
    alwaysShow: alwaysShow,
    meta: {
      requiresAuth: true,
      ...meta
    }
  }
}
export default [{
  ...layout('/crm/workbench', false, {
    // permissions: ['crm', 'marketing']
  }),
  children: [{
    path: 'workbench', // 仪表盘
    component: () => import('@/views/crm/workbench/index'),
    meta: {
      title: '首页',
      icon: 'home'
    }
  }]
},
// {
//   ...layout('/crm/workbench1', false, {
//     permissions: ['crm', 'teaching']
//   }),
//   children: [{
//     path: 'workbench', // 仪表盘
//     component: () => import('@/views/crm/workbench/index4'),
//     meta: {
//       title: '教学部仪表盘',
//       icon: 'board'
//     }
//   }]
// },
// {
//   ...layout('/crm/workbench2', false, {
//     permissions: ['crm', 'salesing']
//   }),
//   children: [{
//     path: 'workbench', // 仪表盘
//     component: () => import('@/views/crm/workbench/index3'),
//     meta: {
//       title: '销售部仪表盘',
//       icon: 'board'
//     }
//   }]
// },
// {
//   ...layout('/crm/workbench3', false, {
//     permissions: ['crm', 'defaultInstrument']
//   }),
//   children: [{
//     path: 'workbench', // 仪表盘
//     component: () => import('@/views/crm/workbench/index5'),
//     meta: {
//       title: '仪表盘',
//       icon: 'board'
//     }
//   }]
// },
{
  ...layout('/crm/message', false),
  hidden: true,
  children: [{
    path: 'message', // 待办事项
    component: () => import('@/views/crm/message'),
    meta: {
      title: '待办事项',
      icon: 'message',
      num: 0
    }
  }]
},
{
  ...layout('/crm/leads', false, {
    permissions: ['crm', 'leads']
  }),
  children: [{
    path: 'leads', // 线索列表
    component: () => import('@/views/crm/leads/AllIndex'),
    meta: {
      title: '线索',
      icon: 'leads'
    }
  }]
},
{
  ...layout('/crm/customer', false, {
    // permissions: ['crm', 'customer']
    permissionList: [
      ['crm', 'customer'],
      ['crm', 'pool'],
      ['crm', 'customer', 'nearbyCustomer']
    ]
  }),
  children: [{
    path: 'customer', // 学员列表
    component: () => import('@/views/crm/customer/AllIndex'),
    meta: {
      title: '学员',
      icon: 'student'
    }
  }]
},
// {
//   ...layout('/crm/contacts', false, {
//     permissions: ['crm', 'contacts']
//   }),
//   children: [{
//     path: 'contacts', // 
//     component: () => import('@/views/crm联系人/contacts/index'),
//     meta: {
//       title: '联系人',
//       icon: 'contacts'
//     }
//   }]
// },
// {
//   ...layout({
//     permissions: ['crm', 'business']
//   }),
//   children: [{
//     path: 'business', // 商机列表
//     component: () => import('@/views/crm/business'),
//     meta: {
//       title: '商机',
//       icon: 'business'
//     }
//   }]
// },
{
  ...layout('/crm/contract', false, {
    permissions: ['crm', 'contract']
  }),
  children: [{
    path: 'contract', // 合同列表
    component: () => import('@/views/crm/contract'),
    meta: {
      title: '合同',
      icon: 'contract'
    }
  }]
},
{
  ...layout('/crm/receivables', false, {
    permissions: ['crm', 'receivables']
  }),
  children: [{
    path: 'receivables', // 回款列表
    component: () => import('@/views/crm/receivables'),
    meta: {
      title: '回款',
      icon: 'receivables'
    }
  }]
},
{
  ...layout('/crm/vipStudents', false, {
    // permissions: ['crm', 'customer']
    permissionList: [
      ['crm', 'vipStudents']
    ]
  }),
  children: [{
    path: 'vipStudents', // 学员列表
    component: () => import('@/views/crm/vipStudents/AllIndex'),
    meta: {
      title: 'VIP学员',
      icon: 'vipstudent'
    }
  }]
},
{
  ...layout('/crm/refund', false, {
    permissions: ['crm', 'refund']
  }),
  children: [{
    path: 'refund', // 回款列表
    component: () => import('@/views/crm/refund'),
    meta: {
      title: '退款',
      icon: 'refund'
    }
  }]
},
{
  ...layout('/crm/msg', false, {
  }),
  hidden: true,
  children: [{
    path: 'message', // 消息列表
    component: () => import('@/views/message/index'),
    meta: {
      title: '消息',
      icon: 'refund'
    }
  }]
},
{
  ...layout('/crm/addressBooks', false, {
    permissions: ['address', 'addressBook','list'],
  }),
  hidden: true,
  children: [{
    path: 'addressBooks',
    component: () => import('@/views/addressBooks/index'),
    meta: {
      title: '企业通讯录',
      icon: 'refund'
    }
  }]
},
{
  ...layout('/crm/person',false,{}),
  hidden: true,
  children: [{
    path: 'index',
    component: () => import('@/views/user/index'),
    meta: {
      title: '个人中心',
    }
  }]
},
// {
//   ...layout('/crm/overdue', false, {
//     permissions: ['crm', 'overdue']
//   }),
//   children: [{
//     path: 'overdue', // 逾期列表
//     component: () => import('@/views/crm/overdue'),
//     meta: {
//       title: '逾期',
//       icon: 'receivables'
//     }
//   }]
// },
{
  name: 'print',
  path: '/print', // 打印
  hidden: true,
  component: () => import('@/views/crm/components/Print'),
  meta: {
    permissionList: [
      ['crm', 'receivables', 'print'],
      ['crm', 'contract', 'print'],
      ['crm', 'business', 'print']
    ],
    title: '打印',
    icon: 'print'
  }
},
// {
//   ...layout('/crm/invoice',false,{
//     permissions: ['crm', 'invoice']
//   }),
//   children: [{
//     path: 'invoice', // 发票列表
//     component: () => import('@/views/crm/invoice'),
//     meta: {
//       title: '发票',
//       icon: 'invoice'
//     }
//   }]
// },
// {
//   ...layout('/crm/visit',false,{
//     permissions: ['crm', 'visit']
//   }),
//   children: [{
//     path: 'visit', // 回访列表
//     component: () => import('@/views/crm/visit'),
//     meta: {
//       title: '回访',
//       icon: 'house'
//     }
//   }]
// },
{
  ...layout('/crm/product', false, {
    permissions: ['crm', 'product']
  }),
  children: [{
    path: 'product', // 产品列表
    component: () => import('@/views/crm/product'),
    meta: {
      title: '产品',
      icon: 'product'
    }
  }]
},
// {
//   ...layout('/crm', true, {
//     icon: 'results-solid',
//     title: 'ROI投放',
//   }),
//   children: [
//     {
//       path: 'roiMoney/roiMoney', // ROI
//       component: () => import('@/views/crm/roiMoney/AllIndex'),
//       meta: {
//         title: '总部投放',
//         icon: 'results-solid',
//         permissions: ['crm', 'roiMoney'],
//         requiresAuth: true
//       }
//     },
//     {
//       path: 'crmPutinAllianceBusiness', // ROI
//       component: () => import('@/views/crm/crmPutinAllianceBusiness/AllIndex'),
//       meta: {
//         title: '合伙人投放',
//         icon: 'results-solid',
//         permissions: ['crm', 'crmPutinAllianceBusiness'],
//         requiresAuth: true
//       }
//     }]
// },
// {
//   ...layout('/crm/allianceBusiness', true, {
//     icon: 'results-solid',
//     title: '财务管理',
//   }),
//   children: [
//     {
//       path: 'allianceBusiness', // ROI
//       component: () => import('@/views/crm/allianceBusiness/AllIndex'),
//       meta: {
//         title: '合伙人充值',
//         icon: 'results-solid',
//         permissions: ['crm', 'allianceBusiness'],
//         requiresAuth: true
//       }
//     },
//     {
//       path: 'allianceBusinessBalance', // ROI
//       component: () => import('@/views/crm/allianceBusinessBalance/AllIndex'),
//       meta: {
//         title: '合伙人余额',
//         icon: 'results-solid',
//         permissions: ['crm', 'allianceBusinessBalance'],
//         requiresAuth: true
//       }
//     },
//   ////////////////
//   {
//     path: 'headquartersBusiness', // 总部充值
//     component: () => import('@/views/crm/headquartersBusiness/AllIndex'),
//     meta: {
//       title: '总部充值',
//       icon: 'results-solid',
//       permissions: ['crm', 'headquartersBusiness'],
//       requiresAuth: true
//     }
//   },
//   {
//     path: 'headquartersBusinessBalance', // 总部余额I
//     component: () => import('@/views/crm/headquartersBusinessBalance/AllIndex'),
//     meta: {
//       title: '总部余额',
//       icon: 'results-solid',
//       permissions: ['crm', 'headquartersBusinessBalance'],
//       requiresAuth: true
//     }
//   }

//   ]
// },
// {
//   ...layout('/crm/timetable', false, {
//     permissions: ['crm'],
//     icon: 'results-solid',
//     title: '课程排期',
//   }),
//   children: [{
//     path: 'timetable', // 课程排期表
//     component: () => import('@/views/crm/timetable/index'),
//     meta: {
//       title: '课程排期表',
//       icon: 'results-solid',
//     }
//   }]
// },
// {
//   ...layout('/crm/set-module', false, {
//     permissionList: [
//       ['crm', 'setup']
//     ],
//     icon: 'manage',
//     title: '设置'
//   }),
//   children: [
//     {
//       path: 'setupLeadsNumber', // 设置上限
//       component: () => import('@/views/crm/set-module/index'),
//       meta: {
//         title: '销售表单上限设置'
//       }
//     },
//   ]
// },
// {
//   ...layout('/crm/source', false, {
//     permissions: ['crm', 'customerSource']
//   }),
//   children: [{
//     path: 'customerSource', // 合同列表
//     component: () => import('@/views/crm/source'),
//     meta: {
//       title: '学员来源',
//       icon: 'manage'
//     }
//   }]
// },
// {
//   ...layout('/crm/crmLargeScreenSetting', false, {
//     permissionList: [
//       ['crm', 'crmLargeScreenSetting']
//     ]
//   }),
//   children: [
//     {
//       path: 'index', // 销售部数据统计
//       component: () => import('@/views/crm/crmLargeScreenSetting/index'),
//       meta: {
//         icon: 'manage',
//         title: '大屏配置'
//       }
//     },
//   ]
// },
]
